package dfbz.homework1;

public class Vehicle {
    private double speed;
    private  String type;

    public Vehicle(double speed, String type) {
        this.speed = speed;
        this.type = type;
    }

    public double getSpeed() {
        return speed;
    }

    public void setSpeed(double speed) {
        this.speed = speed;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public void move() {
        if (type == "奔驰") {
            speedDown();
        } else {
            speedUp();
        }

    }

    public void speedUp() {
        speed++;
        System.out.println("速度为：" + this.speed + ", 类型为：加速");
    }

    public void speedDown() {
        speed--;
        System.out.println("速度为：" + this.speed + ", 类型为：减速");
    }
}
